package conditions.complex

import conditions.BooleanNode

class AndNode extends BooleanNode {

   BooleanNode n1
   BooleanNode n2
   
   public AndNode(BooleanNode n1, BooleanNode n2)
   {
      this.n1 = n1
      this.n2 = n2
   }
   
   @Override
   public boolean evaluate()
   {
      println " AND"
      return n1.evaluate() && n2.evaluate()
   }
   
   /**
   * Necesario para implementar el clone
   */
  boolean equals(Object other)
  {
     other instanceof AndNode && this.n1.equals(other.n1) && this.n2.equals(other.n2)
  }
}